-
-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Fail on fix (#52) #53
Conversation
Good work! I vote for the name being Please remove the object being passed to So this can implemented as a one-liner: onWriteFile: file => {
console.log(`✍️ Fixing up ${chalk.bold(file)}.`);
+ if (args.bail) success = false;
} |
Thanks for the name suggestion, i was looking for something short to avoid the |
README.md
Outdated
@@ -92,6 +92,10 @@ When not in `staged` pre-commit mode, use this flag to compare changes with the | |||
|
|||
Outputs the name of each file right before it is proccessed. This can be useful if Prettier throws an error and you can't identify which file is causing the problem. | |||
|
|||
## `--fail-on-fix` | |||
|
|||
Makes pretty-quick to exit with a non-zero exit code if any file is fixed. The intent is to abort the git commit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to this please:
## `--bail`
Prevent `git commit` if any files are fixed.
78a715d
to
0383a5e
Compare
@aleclarson done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need a different error message when bailing, the current one is
Partially staged files were fixed up
Which is not correct in this case.
Could you also add a test?
Sure, will attempt to add it next week, thanks! |
Added unit tests to #60 |
Thanks @jantimon ! |
The purpose of this is to have something that aborts commits in case any file is fixed.
I added a flag to maintain backwards compatibility, so only users who pass the
--fail-on-fix
will have this behavior.